﻿@namespace Blazorise.Docs.Docs.Examples

<Button Color="Color.Primary" Clicked="@(() => dataGridRef.ResetDisplayOrder())">
    Reset Columns Order
</Button>

<DataGrid @ref="@dataGridRef" TItem="Employee" Data="@employeeList" Responsive>
    <DataGridColumn Field="@nameof( Employee.Id )" Caption="#" Reorderable />
    <DataGridColumn Field="@nameof( Employee.FirstName )" Caption="First Name" Reorderable />
    <DataGridColumn Field="@nameof( Employee.LastName )" Caption="Last Name" Reorderable />
    <DataGridColumn Field="@nameof( Employee.Email )" Caption="Email" Reorderable />
</DataGrid>

@code {
    private DataGrid<Employee> dataGridRef;
    [Inject] public EmployeeData EmployeeData { get; set; }
    private List<Employee> employeeList;

    protected override async Task OnInitializedAsync()
    {
        employeeList = await EmployeeData.GetDataAsync();
        await base.OnInitializedAsync();
    }
}